//---------------------------------------------------------------------------- // File: OS_API_Template.h [v2.4] // Type: A template class. // Author: Ken Anderson // Date: 3/6/6 // OS dependant: NA // // Notes: A class built in the structure of a template to allow operating // system API classes to be built on top of it. The templates may only // contain functions and member variables that are dependant upon the // compiler and not the linker and outside libraries that are only // dependant in one operating system. In otherwords, member variables // can not be of a type that is defined in a windows operating system // API as it may not exist in Linux. // // Note2: All functions defined here return ECERR_NA for Not Applicable. // If a derived class does not override any of the member functions // listed here, it will automatically return not applicable to the main // program. // // Version: // 1.0[2/25/03] -- Original. // 2.0[2/28/06] -- Updated to reflect the common/ambiguous call to a windows event // processing routine such as WndProc in windows. // 2.1[3/3/06] -- Updated to remove the message processing system. // 2.2[3/5/06] -- Updated to include active functionality. // 2.3[3/6/06] -- Updated to allow DrawMedia to use default window size. // 2.4[3/6/06] -- SetWindowSize was appended. // 2.5[3/6/06] -- UpdateWindow was appended. // // Header file's required: // 1) OS_Errorcodes.h -- Contains Operating System error codes specific to program & not the OS. // 2) OS_Messages.h -- Contains Operating System messages specific to the program & not the OS. // 3) OS_Types.h -- Variable, Definition, typedef variables specific to the program & not the OS. // A) MsgMnt.h -- Contains a class to manage messages. // //---------------------------------------------------------------------------- #ifndef _OS_API_TEMPLATE_ #define _OS_API_TEMPLATE_ #include "OS_ErrorCodes.h" #include "OS_Messages.h" #include "OS_Types.h" ////////////////////////////////////////////////////////////////// // Operating System Application Programmable Interface Template // ////////////////////////////////////////////////////////////////// class OS_API_Template { public: //Class dependants OS_API_Template(){}; //Instructor ~OS_API_Template(){}; //Destructor /////////////////////// //Program Controllers// /////////////////////// virtual OS_ERR PrintMsg(cstr pMessage) {return ECERR_NA;} virtual OS_ERR Create() {return ECERR_NA;} //Create the window, instance or process of the program. virtual OS_ERR Destroy() {return ECERR_NA;} //Destroy the window, instance or process of program. virtual OS_ERR Close() {return ECERR_NA;} //Close the window. /////////////////// //Cursor Controls// /////////////////// virtual OS_ERR SetCursor(cstr pzCursor) {return ECERR_NA;} //Set the cursor. virtual OS_ERR GetCursorPos(long* px, long* py) {return ECERR_NA;} //Get the position of the cursor. virtual OS_ERR SetCursorPos(long x, long y) {return ECERR_NA;} //Set the position of the cursor. virtual OS_ERR SetCapture() {return ECERR_NA;} //Captures the mouse's movements. virtual OS_ERR ReleaseCapture() {return ECERR_NA;} //Releases the mouse. /////////////////////// //Quering Controllers// /////////////////////// virtual void QueryOS(POSQuery qc) {return;} //Queries the Operating system virtual cstr GetOS() {return NULL;} //Returns the current operating system, whether it is windows or linux. Calls QueryOS. virtual OS_ERR GetOSVersion() {return ECERR_NA;} //Get the Operating System version, if applicable. virtual OS_ERR GetClientSize(POSRect rc) {return ECERR_NA;} //Get the size of the client. virtual OS_ERR GetWindowSize(POSRect rc) {return ECERR_NA;} //Get the size of the window. /////////////////////// //Window Manipulation// /////////////////////// virtual OS_ERR Minimize() {return ECERR_NA;} //Minimize the window if applicable. virtual OS_ERR Maximize() {return ECERR_NA;} //Maximize the window if applicable. virtual OS_ERR Resize() {return ECERR_NA;} //Resize window, if applicable. virtual OS_ERR SetWindowPos(int ix, int iy, int iWidth, int iHeight, OSZOrder zOrder, uint uFlag) {return ECERR_NA;} //Allows the program to set the size of the window & order. virtual OS_ERR SetWindowSize(int iWidth, int iHeight) {return ECERR_NA;} virtual OS_ERR SetWindowStyle(uint uStyle) {return ECERR_NA;} //Change the windows' style. virtual OS_ERR SetWindowTitle(cstr strTitle) {return ECERR_NA;} //Set the window's title caption. ///////////////////////// //--------Tools--------// ///////////////////////// virtual float Timer(OSTimerState TS){return ECERR_NA;} //////////////////// //Message Handlers// //////////////////// virtual bool Quit(MSG_EVENT state) {return false;} //Is the program quitting? virtual bool SystemManager(bool* pbIdle) {return false;} //See derivied class. virtual bool IsIdling(){return false;} virtual OS_ERR EnableIdle(){return ECERR_NA;} virtual OS_ERR DisableIdle(){return ECERR_NA;} virtual bool IsActive(){return false;} virtual OS_ERR EnableActive(){return ECERR_NA;} virtual OS_ERR DisableActive(){return ECERR_NA;} ///////////////// //System Events// ///////////////// virtual OS_ERR GetChar() {return ECERR_NA;} //Used to get the current character. virtual OS_ERR GetKeyDown() {return ECERR_NA;} //Used to get the key down. virtual OS_ERR GetKeyUp() {return ECERR_NA;} //Used to gather the key up. ///////////////////// // File Management // ///////////////////// virtual OS_ERR FileExists(cstr psFileName) {return ECERR_NA;} //Check file's existence. virtual OS_ERR CreateFile(void*** tvFileHandle, cstr psFileName, Dword dwAccess, Dword dwShare, Dword dwCreationMethod, Dword dwFlags){return EC_OK;} virtual OS_ERR ReadFile(void** hvFile, void* pvBuffer, Dword dwBytesToRead, Dword* pvBytesRead, Dword dwOverlapped){return EC_OK;} virtual OS_ERR WriteFile(void** hvFile, void* pvBuffer, Dword dwBytesToWrite, Dword* pvBytesWritten, Dword dwOverlapped){return EC_OK;} virtual OS_ERR CloseFile(void** hvFile) {return EC_OK;} virtual Qword GetFileSize(void** hvFile){Qword qw; qw.HiDword = 0; qw.LoDword = 0; return qw;} //--- kda (3/18/12) --- Provide the full path of the process so that files can be found locally. virtual OS_ERR GetCurrentDirectory(string* szFullPath) { *szFullPath = ""; return ECERR_NA; } /////////////////////// //Display Controllers// /////////////////////// //General drawing procedures. //Operating Systems that do not use Begin & End for drawing in the GUI //may ignore these functions allowing the program to call through it. //Define the functions below exactly in the derived class. virtual OS_ERR BeginDraw(){return ECERR_NA;} virtual OS_ERR EndDraw(){return ECERR_NA;} //The OS draws the compiled image[pvMedia] to the screen. virtual OS_ERR DrawMedia(void* pvMedia, int iX = 0, int iY = 0, int iWidth = 0, int iHeight = 0) {return ECERR_NA;} virtual OS_ERR DrawMedia(void* pvMedia) {return ECERR_NA;} virtual OS_ERR DrawRectangle(OSRect rc, Byte Red=255, Byte Blue=255, Byte Green=255) {return ECERR_NA;} virtual OS_ERR TextOut(cstr pMessage) {return ECERR_NA;} //Send text out to the screen. virtual OS_ERR MsgBox(cstr sMsg, cstr sCap) {return ECERR_NA;} //Pop up a messagebox, if applicable. //virtual OS_ERR MsgBox(CText txMsg, CText txCap) {return ECERR_NA;} virtual OS_ERR InvalidateDisplay() {return ECERR_NA;} virtual OS_ERR UpdateDisplay() {return ECERR_NA;} virtual OS_ERR CreateFontImageMap(PFONTMAP pfm, cstr sFntName="Arial", int nFntHeight=12, float fScale=1.0f, int nImgHeight=256, int nImgWidth=256, bool bBold=false, bool bItalic=false) {return ECERR_NA;} // NOTE: // Devised from the Microsoft Windows system, the following functions can also // be modified and used for varying windowed type operating systems. // Class Handles. virtual OS_ERR SetWindowState(int nCmdShow) {return ECERR_NA;} //Used for setting the state of the window. virtual OS_ERR SetWindowHMenu(void** hmenu) {return ECERR_NA;} //Used for setting the menu of the window. virtual OS_ERR SetHInstance(void** hinst) {return ECERR_NA;} //Used for setting the instance of the program. virtual OS_ERR SetWindowHIcon(void** hicon) {return ECERR_NA;} //used for setting the Icon of the window. // Resource IDs. virtual OS_ERR SetWindowIcon(Word wIconID) {return ECERR_NA;} virtual OS_ERR SetWindowMenu(Word wMenuID) {return ECERR_NA;} // System Procedures. virtual Dword DefaultOSProc(Word wMsg, Dword dwwParam, Dword dwlParam){return 0;} }; #endif